#define  _CRT_SECURE_NO_WARNINGS
#include <iostream>
using namespace std;
#include "BSTree.h"
void test1()
{
	int a[] = { 10, 5, 15, 3, 8, 13, 18, 4, 7, 9, 16 };
	BSTree<int> t1;
	for (auto e : a)
	{
		t1.insertR(e);
	}

	cout << t1.findR(16);
	//cout << t1.find(7);
	t1.erase(15);
	t1.InOrder();

	t1.erase(13);
	t1.InOrder();

	t1.erase(18);
	t1.InOrder();

	t1.erase(16);
	t1.InOrder();

	t1.erase(5);
	t1.InOrder();

	for (auto e : a)
	{
		t1.erase(e);
		t1.InOrder();
	}
}
void test2()
{
	int a[] = { 10, 5, 15, 3, 8, 13, 18, 4, 7, 9, 16 };
	BSTree<int> t1;
	for (auto e : a)
		t1.insert(e);
	BSTree<int> t2;
	t2 = t1;
	for (auto e : a)
	{
		t2.erase(e);
		t2.InOrder();
	}


	//for (auto e : a)
	//{
	//	t1.insertR(e);
	//}
	t1.eraseR(15);
	t1.InOrder();

	t1.eraseR(13);
	t1.InOrder();

	t1.eraseR(18);
	t1.InOrder();

	t1.eraseR(16);
	t1.InOrder();

	t1.eraseR(5);
	t1.InOrder();
	for (auto e : a)
	{
		t1.erase(e);
		t1.InOrder();
	}

}
int main()
{
	const int a = 0;
	int b = a;
	test2();
	return 0;
}
